import { allCompetitions,
    competitionDetail,
    competitionSignUp,
    getUserSignUpStatus,
    createGroup,
    checkupLoad,
    checkCompetitionData,
    getCompetitionInfo,
    getCompetitionTopic,
    downLoadCmpData,
    getCompetitionDataList,
    getScores,
    getMyGroup,
    getGroupMember,
    deleteMember,
    inviteMember,
    leaveGroup,
    rankList,
    compDiscussList,
    compDiscussDel,
    compDiscussAdd,
    compDiscussVote,
    compDiscussReply,
    compDiscussReplyAdd } from '../../api/competitions'

export default {
    state:{
        info:{}
    },
    mutations:{
        GET_GROUP_INFO(state,params){
            state.info = {...params}
        }
    },
    actions:{
        XallCompetitions(context,params){
            return allCompetitions(params)
        },
        // 赛事详情
        XcompetitionDetail(context,params){
            return competitionDetail(params)
        },
        XgetUserSignUpStatus(context,params){
            return getUserSignUpStatus(params)
        },
        // 报名
        XcompetitionSignUp(context,params){
            return competitionSignUp(params)
        },
        // 组建团队
        XcreateGroup(context,params){
            return createGroup(params)
        },
        // 赛事简介
        XgetCompetitionInfo(context,params){
            return getCompetitionInfo(params)
        },
        //赛题与数据
        XgetCompetitionTopic(context,params){
            return getCompetitionTopic(params)
        },
        XdownLoadCmpData(context,params){
            return downLoadCmpData(params)
        },
        XgetCompetitionDataList(context,params){
            return getCompetitionDataList(params)
        },
        //我的成绩
        XgetScores(context,params){
            return getScores(params)
        },
        //我的团队
        XgetMyGroup(context,params){
            return getMyGroup(params).then(res => {
                context.commit("GET_GROUP_INFO",res.data)
            })
        },
        XgetGroupMember(context,params){
            return getGroupMember(params)
        },
        XdeleteMember(context,params){
            return deleteMember(params)
        },
        XinviteMember(context,params){
            return inviteMember(params)
        },
        XleaveGroup(context,params){
            return leaveGroup(params)
        },
        //排行榜
        XrankList(context,params){
            return rankList(params)
        },
        //论坛
        XcompDiscussList(context,params){
            return compDiscussList(params)
        },
        XcompDiscussDel(context,params){
            return compDiscussDel(params)
        },
        XcompDiscussAdd(context,params){
            return compDiscussAdd(params)
        },
        XcompDiscussVote(context,params){
            return compDiscussVote(params)
        },
        XcompDiscussReply(context,params){
            return compDiscussReply(params)
        },
        XcompDiscussReplyAdd(context,params){
            return compDiscussReplyAdd(params)
        }
    }
}